package com.zking.shiro.service.impl;

import com.zking.shiro.mapper.PermissionMapper;
import com.zking.shiro.model.Permission;
import com.zking.shiro.model.Role;
import com.zking.shiro.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PermissionServiceImpl implements IPermissionService {

    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public int deleteByPrimaryKey(Long permissionId) {
        return permissionMapper.deleteByPrimaryKey(permissionId);
    }

    @Override
    public int insert(Permission record) {
        return permissionMapper.insert(record);
    }

    @Override
    public int del(Permission permission) {
        permissionMapper.delRolePms(permission);
        System.out.println("角色权限删除成功");
        return permissionMapper.deleteByPrimaryKey(permission.getPermissionId());
    }
}
